<template>
  <div>
    <el-button icon="el-icon-printer" @click="print()">打印</el-button>
  </div>
</template>

<script>
import printTag from "@/utils/printTags"

export default {
  name: "PageTop",

  mixins:[printTag],
  data() {
    return {
      multipleSelection: [
        {
          id: "itemId",
          itemName: "测试设备",
          itemCode: "itemCode",
          boxCode: "888",
          qty: "666",
          sourceNo: "sourceNo",
          batchNo: "batchNo",
          unitName: "雅马哈",
          itemSpecifications: "itemSpecifications",
          brand: "brand",
        }]
    };
  },
  methods: {
    print(){
      //debugger;
      if(this.multipleSelection.length>0){
        this.multipleSelection.forEach((item,index)=>{
          // if(item.status != "2"&& item.status !="3"){
          let qrCode =[item.sourceNo,item.boxCode,'商品',item.itemCode,item.qty,item.itemId].join('/') ;
          let writeData = '^XA'+
            '^CI28'+
            '^SEE:GB18030.DAT'+
            '^CW3,E:SIMSUN.TTF'+
            '^LH0,0'+
            '^MD15'+
            '^FO100,50^A3N,48,48^FD商品名称：^FS^FO400,50^A3N,48,48^FD'+item.itemName+'^FS'+
            '^FO100,150^A3N,48,48^FD商品编码：^FS^FO400,150^A3N,48,48^FD'+item.itemCode+'^FS'+
            '^FO100,250^A3N,48,48^FD来源单号：^FS'+'^FO400,250^A3N,48,48^FD'+item.sourceNo+'^FS'+
            '^FO100,350^A3N,48,48^FD箱号编码：^FS'+'^FO400,350^A3N,48,48^FD'+item.boxCode+'^FS'+
            '^FO100,450^A3N,48,48^FD数量：^FS'+'^FO400,450^A3N,48,48^FD'+item.qty+'^FS'+
            '^FO100,550^A3N,48,48^FD批次：^FS'+'^FO400,550^A3N,48,48^FD'+item.batchNo+'^FS'+
            '^FO100,650^A3N,48,48^FD单位名称：^FS^FO400,650^A3N,48,48^FD'+item.unitName+'^FS'+
            '^FO100,750^A3N,48,48^FD规格：^FS^FO400,750^A3N,48,48^FD'+item.itemSpecifications+'^FS'+
            '^FO100,850^A3N,48,48^FD品牌：^FS^FO400,850^A3N,48,48^FD'+item.brand+'^FS'+
            // '^FO800,100^PON^BQ2,2,3^A3N,24,24^FDLA,'+qrCode+'^FS'+
            '^FO800,300^PON^BQ2,2,8^A3N,24,24^FDLA,'+qrCode+'^FS'+
            // '^FO600,500^BY2^BCN,90,N^FD'+qrCode+'^FS'+
            // '^FO640,600^ATN,24,24^FD'+qrCode+'^FS'+
            '^FO70,30^GB1100,880,6^FS'+
            '^XZ';
          this.printCustom(writeData,
            ()=>{
              console.log(item.id)

            },function(err){
              console.log(err)
            })

        })


      }

    },

  },

};
</script>

<style></style>
